<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1">
    <title id="bv20941">CREATE USER MAPPING</title>
    <body>
        <p id="sql_command_desc">Defines a new mapping of a user to a foreign server.</p>
        <section id="section2">
            <title>Synopsis</title>
            <codeblock id="sql_command_synopsis">CREATE USER MAPPING FOR { <varname>username</varname> | USER | CURRENT_USER | PUBLIC }
    SERVER <varname>servername</varname>
    [ OPTIONS ( <varname>option</varname> '<varname>value</varname>' [, ... ] ) ]</codeblock>
        </section>
        <section id="section3">
            <title>Description</title>
            <p><codeph>CREATE USER MAPPING</codeph> defines a mapping of a user to a foreign server.
                You must be the owner of the server to define user mappings for it.</p>
        </section>
        <section id="section4">
            <title>Parameters</title>
            <parml>
                <plentry>
                    <pt><varname>username</varname></pt>
                    <pd>
                        <p>The name of an existing user that is mapped to the foreign server.
                                <codeph>CURRENT_USER</codeph> and <codeph>USER</codeph> match the
                            name of the current user. <codeph>PUBLIC</codeph> is used to match all
                            present and future user names in the system. </p>
                    </pd>
                </plentry>
                <plentry>
                    <pt><varname>servername</varname></pt>
                    <pd>
                        <p>The name of an existing server for which Greenplum Database is to create the user mapping.</p>
                    </pd>
                </plentry>
                <plentry>
                    <pt>OPTIONS ( <varname>option</varname> '<varname>value</varname>' [, ... ] )</pt>
                    <pd>
                        <p>The options for the new user mapping. The options typically define the actual user name and password of the mapping. Option names must be unique. The option names and values are specific to the server's foreign-data wrapper.</p>
                    </pd>
                </plentry>
            </parml>
        </section>
        <section id="section6">
            <title>Examples</title>
            <p>Create a user mapping for user <codeph>bob</codeph>, server <codeph>foo</codeph>:</p><codeblock>CREATE USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'secret');</codeblock>
        </section>
        <section id="section7">
            <title>Compatibility</title>
            <p><codeph>CREATE USER MAPPING</codeph> conforms to ISO/IEC 9075-9 (SQL/MED).</p>
        </section>
        <section id="section8">
            <title>See Also</title>
            <p><codeph><xref href="ALTER_USER_MAPPING.xml#topic1">ALTER USER MAPPING</xref></codeph>,
                        <codeph><xref href="DROP_USER_MAPPING.xml#topic1">DROP
                    USER MAPPING</xref></codeph>,
                        <codeph><xref href="CREATE_FOREIGN_DATA_WRAPPER.xml#topic1">CREATE
                    FOREIGN DATA WRAPPER</xref></codeph>,
                        <codeph><xref href="CREATE_SERVER.xml#topic1">CREATE
                    SERVER</xref></codeph></p>
        </section>
    </body>
</topic>
